This is a quick overview. Please read the manual (readme.txt) for details!

Syntax
------
Allowed parameter formats:
- "string"
  quoted string: contained whitespaces remain unmodified, use double quotes
  to include quotes (e.g. "This is ""quoted"""), ^CR^=carriage return,
  ^LF^=line feed, ^NL^=new line (Windows/DOS = ^CR^^LF^), ^TAB^=tabulator.
- variable
  contents of the variable
- expression
  result of the expression, e.g. "Variable = "&variable

For assignments (variable = expression), array indexes, and in expressions,
percent signs around variables are optional (i.e., %x% = %y[%z%]% is the
same as x = y[z]), strings must be quoted.

For boolean parameters (yes/no, true/false), 1 is yes/true, 0 is no/false.
There are also these predefined variables:
ON, YES, TRUE = 1
OFF, NO, FALSE = 0
CANCEL = 2

Lines can be continued by using "\" as last character. Example:
Message message, \
        "Title"

Comments must start with "#" (trailing whitespaces are allowed). Example:
# This is a comment

If "x =" is used, it is a function. This means, it returns a value and must be
used in an expression (command parameter or condition). For example:
var = Input( "Enter value" )
If( wndExists( "Explorer" ) )
  ...
EndIf
Message( "Your input: " & Input( "Value:" ) )

Error handling
--------------
ErrorLevel( "off"|"critical"|"syntax"|"error"|"warn" )

Set variables
-------------
Set( <variable>,<expression> ) (better use <variable> = <expression>)
<variable> = <expression>

String operations
-----------------
x = Split( <string>,<seperator>,<trim?>,<variable>{,<variable>} ) (if only one variable, it's used as array)
x = Part( <string>,<seperator>,<index>[,<trim?>] )
x = Length( <string> )
x = SubStr( <string>,<start>,<length> )
x = Find( <string>,<search string> )
x = ReverseFind( <string>,<search character> )
x = ToUpper( <string> )
x = ToLower( <string> )

Evaluate expressions in strings
-------------------------------
x = Eval( <expression as string> ) (e.g. res = Eval("var" & index & " & ""...""") )

Execution
---------
Run( <application> [, <parameter>] )
RunWait( <application> [, <parameter>] )
New( <menu entry> ) (Windows Mobile only)

RunAt( <unix timestamp>, <application> [, <parameter>] )
RunAt( <year>, <month>, <day>, <hour>, <minute>, <application> [, <parameter>] )
RunOnPowerOn( <application> [, <parameter>] )
RemoveNotifications( <application> [, <parameter>] )

Window control
--------------
Show( <window title> )
Minimize( <window title> )
Close( <window title> )
x = ActiveWindow()
x = WndActive( <window title> )
x = WndExists( <window title> )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )
x = WindowText( <x>, <y> )
SendOK [ ( <window title> ) ]
SendCancel [ ( <window title> ) ]
SendYes [ ( <window title> ) ]
SendNo [ ( <window title> ) ]

Sending keys
------------
SendKeys( [<window title>,]<string> )
Send<special character> [ ( <window title>,<ctrl>,<shift> ) ]
  Special charaters: CR, Tab, Esc, Space, Backspace, Delete, Insert
                     Up, Down, Left, Right, Home, End, PageUp, PageDown,
                     LeftSoft, RightSoft, Win, Context
Snapshot [ ( <window title> ) ]
SendCtrlKey( [<window title>,]<key> )

Sending taps ("mouse events")
-----------------------------
MouseClick( [<window title>,]<x>,<y> )
MouseDblClick( [<window title>,]<x>,<y> )
MouseDown( [<window title>,]<x>,<y> )
MouseUp( [<window title>,]<x>,<y> )

PC version only: Prefix with "Middle" or "Right" for those buttons, e.g. RightMouseClick(...)

Waiting
-------
Sleep( <milliseconds> )
SleepMessage( <seconds>,<message>[,<title>[,<allowOK>[,<condition]]] )
WaitFor( <window title>,<seconds> )
WaitForActive( <window title>,<seconds> )

Time
----
x = Time()   (Unix timestamp)
x = FormatTime( <format> [, <timestamp> ] ) (formatted)
GetTime( <variable>,<variable>,<variable> ) (hour, minute, seconds)
GetTime( <variable>,<variable>,<variable>,<variable>,<variable>,<variable> )
        (hour, minute, seconds, day, month, year)

Copy, rename, move, delete files
--------------------------------
Copy( <source file>,<target file>[,<overwrite?>] )
XCopy( <source files>,<target directory>[,<overwrite?>] )
Rename( <source file>,<target file>[,<overwrite?>] )
Move( <source files>,<target directory>[,<overwrite?>] )
Delete( <files> )
DelTree( <files> )
CreateShortcut( <shortcut file>,<target file> )

Read and write text files
-------------------------
x = IniRead( <file/url>,<section>,<key>,<variable> )
x = ReadFile( <file/url> )
WriteFile( <file>,<contents>,<append?> )

COM access
----------
SetComInfo( <port>, <timeout> [, <baud rate> [, <parity> [, <bits>
            [, <stop bits> [, <control> ]]]]] )
port: "COM1:" to "COM9:"
baud rate: usually one of 4800, 9600, 19200, 38400, 57600, 76800, 115200
parity: "none", "even", "odd", "mark", "space"
bits: 4-8, usually 8
stop bits: 1, "1.5", 2
control: "none", "RTS/CTS", "XON/XOFF"


File system informations
------------------------
x = FileExists( <file> )
x = DirExists( <directory> )
x = FileCreateTime( <file> )
x = FileModifyTime( <file> )
x = FileSize( <file> )
x = FreeDiskSpace( <directory> )
x = FileAttribute( <file>, <attribute> )
SetFileAttribute( <file>, <attribute>, <set?> )
  Allowed values for attribute:
  directory (cannot be set), hidden, readonly, system, archive
SetFileAttribs( <file>,<readonly>[,<hidden>[,<archive>]] ) (1=set,0=remove,""/omit=keep)
x = FileVersion( <file> )
GetVersion( <file>,<variable>,<variable>,<variable>,<variable> )

Zip files
---------
Please note: ZIP doesn't support Unicode for filenames.
MortScript uses the old DOS encoding 437, like most popular ZIP progrograms.
I.e., you might get troubles with (un)zipping files with non-ASCII characters.
Rate: 0=no compression, 9=highest

ZipFile( <source file>,<zip file>,<filename in archive>[,<rate>] )
ZipFiles( <source files>,<zip file>[,<subdirectories?>[,<path in zip>[,<rate>]]] )
UnzipFile( <zip file>,<filename in archive>,<target file> )
UnzipAll( <zip file>,<target directory> )
UnzipPath( <zip file>,<path in archive>,<target directory> )

Connections
-----------
Connect( <connection name> )   for fixed connection name
Connect( <title>, <message> )  for selection of connections
Connect                        for default http connection
CloseConnection                closes only connection established by "Connect"
Disconnect                     closes all connections (GPRS, ActiveSync, ...)
x = Connected()
x = InternetConnected( [<url>] )
SetProxy( <proxy> )            not necessary if Connect was used
Download( <url>,<target file> )

Directory operations
--------------------
MkDir( <directory> )
RmDir( <directory> )
ChDir( <directory> ) PC version only!
SystemPath( <path> )
  valid values for path: ProgramsMenu, StartMenu, Startup, Documents, ProgramFiles,
                         ScriptExe, ScriptPath, ScriptName, ScriptExt

Registry
--------
RegWriteString( <root>,<path>,<key>,<value> )
RegWriteDWord(  <root>,<path>,<key>,<value> )
RegWriteBinary( <root>,<path>,<key>,<value> )
x = RegRead( <root>,<path>,<key> )
RegDelete( <root>,<path>,<key> )
RegDeleteKey( <root>,<path>,<values?>,<recursive?> )
x = RegKeyExists( <root>,<path> )
x = RegValueExists( <root>,<path>,<value> )

"root" values: HKCU (HKEY_CURRENT_USER), HKLM (HKEY_LOCAL_MACHINE),
               HKCR (HKEY_CLASSES_ROOT), HKUS (HKEY_USERS)

Binary values are handled as strings whith the hex dump, e.g. "01020A".

Dialog
------
x = Input( <message> [,<title> [,<numeric?> [, <multiline?> [, <default> ]]]] )
Message <text>[,<title>]
BigMessage <text>[,<title>]
SleepMessage( <seconds>,<message>[,<title>[,<allowOK>[,<condition]]] )
x = Question( <message> [,<title> [,<type>]] )  (Type=OkCancel,YesNo,YesNoCancel; Yes/OK=1,No=0,Cancel=2)
x = Choice( <title>,<message>,<default>,<timeout>,<array> ) (if only one text is given, it's assumed to be a array variable)
x = Choice( <title>,<message>,<default>,<timeout>,<text1>,<text2>{,<text3>} ) (if only one text is given, it's assumed to be a array variable)

Processes
---------
x = ProcExists( <process name> )
x = ScriptProcExists( <script name> )
x = ActiveProcess()
Kill( <process name> )
KillScript( <script name> )

Signals
-------
SetVolume( <value> )   (Windows Mobile only)
PlaySound( <wav file> )
Vibrate( <milliseconds> )

Display/screen
--------------
x = ColorAt( <x>,<y> )
x = RGB( <red>,<green>,<blue> )
Rotate( 0|90|180|270 ) (only Windows Mobile 2003 SE or higher)
SetBacklight( <battery>,<external> ) (PPC only)
ToggleDisplay( <on/off> ) (PPC only)
x = Screen( "landscape"|"portrait"|"vga"|"qvga" )
RedrawToday
ShowWaitCursor
HideWaitCursor

Clipboard
---------
SetClipText( <text> )
x = GetClipText()

Memory
------
x = FreeMemory()
x = TotalMemory()

Energy
------
x = ExternalPowered()
x = BatteryPercentage()
PowerOff
IdleTimerReset (Windows Mobile only)

System
------
MortScriptType()
x = SystemVersion( [<element>] )
  element: "major", "minor", "build", "platform", omit for major.minor.build
Reset (Windows Mobile only)

Control structures
------------------
If <condition>
[ Else ]
EndIf

  Choice <title>,<message>,<text1>[,<text2>,...]
| ChoiceDefault <title>,<message>,<default>,<timeout>,<text1>,[<text2>,...]
Case <index>[,<index>,...]
EndChoice
(if only one text is given, it's assumed to be a array variable)

Switch <value>
Case <index>[,<index>,...]
EndSwitch

While <condition>
EndWhile

Repeat <count>
EndRepeat

  ForEach <variable> in values <value>{,<value>}
| ForEach <variable> in split <string>,<seperator>,<trim?>
| ForEach <variable> in array <array variable>
| ForEach <variable> in charsOf <string>,<seperator>
| ForEach <variable> in iniSections <file/url>
| ForEach <keyVariable>,<valueVariable> in iniKeys <file/url>,<section>
| ForEach <variable> in files <file/url>,<files>
| ForEach <variable> in directories <file/url>,<directories>
EndForEach

Call <subroutine>

CallScript <mortscript file (full path!)>

Sub <subroutine>
EndSub

Exit

Expressions
-----------
Strings:   "any text, ""in quotes"""
Numbers:   123 (only integer operations!)
Variables: variable, array[index]

Operators by priority (highest first):
()        Brackets
NOT       Negation (True<->False)
* / MOD   Multiplication, division, modulo (remainder)
+ -       Addition, subtraction
& \       String concatenation (\ for paths)
>,  >=, <,  <=, =,  <>   Numerical comparsions
gt, ge, lt, le, eq, ne   Alphanumerical comparsions
AND &&    Binary/logical and
OR  ||    Binary/logical or

Numerical and alphanumerical comparsions have same priority,
they're only splitted for better overview.
AND and OR use binary logic, i.e. 3 AND 7 will return 3 (111 AND 011 = 011),
while && and || use "C logic", i.e. everything that's not 0 is "true" (1), so
3 && 7 will return 1.


Conditions
----------
Only for compatibility, please use functions instead!
I.e. "If ( wndExists( "window" ) )" instead of "If wndExists "window"".

[not] equals <value1>,<value2>
[not] expression <expression>
[not] fileExists <file>
[not] dirExists <directory>
[not] procExists <application>
[not] wndExists <window title>
[not] wndActive <window title>
[not] question <text>[,<title>]
[not] screen landscape|portrait|vga|qvga
[not] regKeyExists <root>,<path>,<key>
[not] regKeyEqualsString <root>,<path>,<key>,<value>
[not] regKeyEqualsDWord <root>,<path>,<key>,<value>


Obsolete
--------
Eval <variable>,<expression as string> (e.g. { "%var" & %index% & "% & ""...""" })
Input <variable>,<numeric?>,<message>[,<title>]
GetPart <string>,<seperator>,<trim?>,<index>,<variable>
SubStr <string>,<start>,<length>,<variable>
Find <string>,<search string>,<variable>
ReverseFind <string>,<search character>,<variable>
MakeUpper <variable>
MakeLower <variable>
GetRGB <red>,<green>,<blue>,<variable>
GetActiveWindow <variable>
GetVersion <file>,<variable>
IniRead <file/url>,<section>,<key>,<variable>
ReadFile <file/url>,<variable>
GetSystemPath <path>,<variable>
RegReadString  <root>,<path>,<key>,<variable>
RegReadDWord   <root>,<path>,<key>,<variable>
RegReadBinary  <root>,<path>,<key>,<variable>
Input <variable>,<numeric?>,<message>[,<title>]
GetMortScriptType <variable>
GetSystemPath [ProgramsMenu|StartMenu|Startup|Documents|ProgramFiles],<variable>
GetColorAt <x>,<y>,<variable>
GetWindowText <x>,<y>,<variable>
GetClipText <variable>
GetActiveProcess <variable>
